package com.hugoo.extra.xlsx;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 *
 * @author Lovelock.Chan
 */
public class Test {

    public static void main(String[] args) {
        try {
            Exl e = new Exl(new File("E:/txt.xlsx"));
            e.setTitle("test");
            e.addRowTitle(new String[]{"分析", "测试", "分析", "测试", "分析", "测试"});
            int i = 0, c = 20;
            boolean b[] = {true, false, true, false, true, false, false, false, false, false,true, false, true, false, true, false, false, false, false, false};
            long l = System.currentTimeMillis();
            while (true) {
                e.addRow(i);
                i++;
                for (int z = 0; z < c; z++) {
                    if (b[z]) {//以数值方式插入数据值
                        e.createCell(z, 100 * i * z, Exl.STYLE_NUM);
                    } else {
                        e.createCell(z, "中文" + z + "dfds" + i, Exl.STYLE_TXT);
                    }
                }
                e.packRow();
                if (i > 299999) {
                    break;
                }
            }
            System.out.println(System.currentTimeMillis() - l);
            l = System.currentTimeMillis();
            e.pack();
            System.out.println(System.currentTimeMillis() - l);
        } catch (FileNotFoundException ex) {
            ex.printStackTrace(System.err);
        } catch (IOException ex) {
            ex.printStackTrace(System.err);
        }
    }
}
